package com.kunzai.server.controller;

import com.kunzai.server.pojo.Dish;
import com.kunzai.server.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

@RestController
@RequestMapping("/DishRun")
public class DishController {

    @Autowired
    private DishService dishService;



    /**
     * 根据菜品名称查询出来所有的信息
     */
    @GetMapping("/Dishdetails")
    public Dish selectName(@RequestParam String dishName){
      Dish dish  = dishService.selectName(dishName);

        return dish;
    }

    /**
     * 根据菜品名称进行模糊查询
     */
    @GetMapping("/selectLike")
    public Set<Dish> selectLike(@RequestParam String dishNmeu){

      Set<Dish> setDishList = dishService.selectLike(dishNmeu);

        return setDishList;
    }

}
